<?
//引入所有子系统信息
include_once("../../../common/script/extender_import.php");



//根据接收过来的数据，对比日期和产品的变化。


//print_r2($_REQUEST);

$_order_detail=select_lines_all_items($table_prefix."order_detail","",
    "order_nid = '{$_REQUEST['order_nid']}'","");

//和原来数据对比，不同的则更新一下。
foreach ($_order_detail as $key=>$value)
{
    //data,milk,remark对比不同的nid的这三个数据，不相同的话，则赋值到  $_data['ai_']中
    if(
        (
            ($value['ondate'] != ($_REQUEST['date'][$value['nid']]." 00:00:00")) or
            ($value['product_name'] != $_REQUEST['milk'][$value['nid']]) or
            ($value['remark'] != $_REQUEST['remark'][$value['nid']])
        )   and
        $_REQUEST['milk'][$value['nid']] != '' and
        $_REQUEST['date'][$value['nid']] != ''
       )
    {
//        echo $value['nid'];
//        echo "<br/>";
//        echo $value['ondate']." - ". $_REQUEST['date'][$value['nid']]." 00:00:00";
//        echo "<br/>";
//        echo $value['product_name']." - ". $_REQUEST['milk'][$value['nid']];
//        echo "<br/>";
//        echo $value['remark']." - ". $_REQUEST['remark'][$value['nid']];
//        echo "<br/>";
        $_data = array();
        $_data['ai_ondate'] = $_REQUEST['date'][$value['nid']]." 00:00:00";
        $_data['ai_product_name'] = $_REQUEST['milk'][$value['nid']];
        $_data['ai_remark'] = $_REQUEST['remark'][$value['nid']];

        $_sql=update_date($table_prefix."order_detail",$_data,"nid",$value['nid']);
        $query = do_query($_sql) or die ("error:".mysqli_error());
    }

   // print_r2($_data);
}



//处理数据并且update
//获取数据

//$sql=update_date($table_prefix."order_info",$_REQUEST,"order_id",$_REQUEST['order_id']);
//$query = do_query($sql) or die ("error:".mysqli_error());

?>


<script type="text/javascript">

    alert("输入信息已保存，点击确认返回继续操作.");
    document.location.href = "data_schedule_window.php?nid=<?echo $_REQUEST['order_nid']?>"

</script>
